package com.partner.share.work.mybatis.plus.config;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.partner.share.work.mybatis.plus.handler.UpdateAndCreateIdMetaObjectHandler;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * @author pengyangyan
 */
@Configuration
@EnableTransactionManagement
public class MybatisPlusConfig {


    /**
     * 分页插件
     */
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
        paginationInterceptor.setLimit(500);
        return paginationInterceptor;
    }

    @Bean
    public UpdateAndCreateIdMetaObjectHandler updateAndCreateIdMetaObjectHandler(){
        return new UpdateAndCreateIdMetaObjectHandler();
    }



}
